package com.test.java.spi;

import java.util.ServiceLoader;

/**
 * @Author TongRui乀
 * @Date 2023/05/02:20:47
 * @Description 测试SPI
 */
public class SpiMain {

    public static void main(String[] args) {

        ServiceLoader<MyService> myServices = ServiceLoader.load(MyService.class);

        myServices.stream().forEach(service-> System.out.println(service.get().sayHello()));

    }

}
